#include <stdio.h>
#include <pthread.h>
#include <semaphore.h>

#include "awb/provides/connected_application.h"
#include "awb/provides/stats_service.h"

//#include "asim/provides/connected_application.h"
//#include "asim/provides/stats_service.h"


using namespace std;

// constructor
CONNECTED_APPLICATION_CLASS::CONNECTED_APPLICATION_CLASS(VIRTUAL_PLATFORM vp) //:
//  clientStub(new PROCESSORSYSTEMRRR_CLIENT_STUB_CLASS(this))
{
	printf( "CONNECTED_APPLICATION_CLASS constructed\n" ); fflush(stdout);
}

// destructor
CONNECTED_APPLICATION_CLASS::~CONNECTED_APPLICATION_CLASS()
{
}

// init
void
CONNECTED_APPLICATION_CLASS::Init()
{
	printf( "CONNECTED_APPLICATION_CLASS Init\n" ); fflush(stdout);
  // enable stats 
//  STATS_SERVER_CLASS::GetInstance()->SetupStats();
}


// main
void
CONNECTED_APPLICATION_CLASS::Main()
{
  int sleepCount = 0;
  int result = 0;

	printf( "Starting Decompressor!\n" );
  fflush(stdout); 

	STARTER_DEVICE_CLASS::GetInstance()->WaitForHardware(); 

//	while (1) {
//		sleep(1);
//	}
	/*
  if(result == 1) {
    printf("\n***PASSED***\n");
  }
	*/

  // Dump the stats file

//  STATS_SERVER_CLASS::GetInstance()->DumpStats();
//  STATS_SERVER_CLASS::GetInstance()->EmitFile();

  fflush(stdout); 
  exit(0);
}
